<template>
	<view class="content">
		<view class="section-0">
			<view class="section-body">
				<view class="list-container">
					<view class="header">
						<view class="item">姓名</view>
						<view class="item">项目部</view>
						<view class="item">人员类型</view>
						<view class="item">进场时间</view>
					</view>
					<view class="body">
						<view class="row" v-for="item in list" :key="item.name">
							<view class="item">{{item.name}}</view>
							<view class="item">{{item.department}}</view>
							<view class="item">{{item.user_type}}</view>
							<view class="item time">{{item.into_time}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { analysisDetailApi} from '@/api/statistics.js';
	export default {
		data() {
			return {
				id: '',
				name: '',
				list: []
			}
		},
		methods: {
			async fetchInfo() {
				uni.showLoading({title: '加载中...'});
				const {data} = await analysisDetailApi({project_id: this.id});
				if (data.code === 1) {
					this.list = data.data;
				}
				uni.hideLoading();
			}
		},
		onLoad(data) {
			console.log(data)
			this.id = JSON.parse(data.params).id;
			this.name = JSON.parse(data.params).project_name;
			uni.setNavigationBarTitle({
				title: this.name
			});
		},
		onReady() {
			uni.setNavigationBarTitle({
				title: this.name
			});
			this.fetchInfo()
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		background-color: #fafbfd;
	}
	.section-0{
		width: 100%;
		background-color: #3a5df5;
		.section-body{
			width: 100%;
			padding-left: 40rpx;
			padding-right: 40rpx;
			padding-bottom: 50rpx;
			padding-top: 50rpx;
			background-color: #fafbfd;
			background-size: cover;
			background-repeat: no-repeat;
			border-top-left-radius: 50rpx;
			border-top-right-radius: 50rpx;
			overflow: hidden;
			box-sizing: border-box;
			.list-container{
				width: 100%;
				background: #fff;
				border-radius: 35rpx;
				box-shadow: 0 0 20rpx 10rpx rgba(#bcbcb5, 0.17);
				margin-bottom: 65rpx;
				padding-top: 40rpx;
				padding-bottom: 40rpx;
				@include clear();
				position: relative;
				.body{
					margin: 0 auto;
					width: 636rpx;
					.row{
						width: 100%;
						height: 104rpx;
						line-height: 104rpx;
						display: flex;
						justify-content: space-between;
						border-bottom: solid 2rpx #e2e7f5;
						&:last-child{
							border-bottom: none;
						}
						.item{
							margin-top: 22rpx;
							width: 25%;
							text-align: center;
							height: 60rpx;
							line-height: 60rpx;
							font-size: 26rpx;
							font-weight: normal;
							font-stretch: normal;				
							letter-spacing: 0rpx;
							color: #3b3c40;
						}
						.time{
							line-height: 30rpx;
						}
					}
				}
				.header{
					margin: 0 auto;
					width: 636rpx;
					height: 48rpx;
					background-color: #95c4fa;
					border-radius: 20rpx;
					display: flex;
					justify-content: space-between;
					.item{
						width: 25%;
						text-align: center;
						height: 48rpx;
						line-height: 48rpx;
						font-size: 26rpx;
						font-weight: normal;
						font-stretch: normal;				
						letter-spacing: 0rpx;
						color: #3b3c40;
					}
				}
			}
		}
	}
</style>
